package com.summary.richtext.utils.enums;

import java.util.HashMap;

public enum RichFontStyle {

    SIZE_ONE(8,"1"),
    SIZE_TWO(10,"2"),
    SIZE_THREE(12,"3"),
    SIZE_FOUR(14,"4"),
    SIZE_FIVE(16,"5"),
    SIZE_SIX(18,"6"),
    SIZE_SEVEN(20,"7"),
    SIZE_EIGHT(22,"8");

    private int code;
    private String msg;
    RichFontStyle(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public static HashMap<Integer, String> getSizeMap() {
        HashMap<Integer, String> map = new HashMap<>();
        map.put(RichFontStyle.SIZE_ONE.getCode(),RichFontStyle.SIZE_ONE.getMsg());
        map.put(RichFontStyle.SIZE_TWO.getCode(),RichFontStyle.SIZE_TWO.getMsg());
        map.put(RichFontStyle.SIZE_THREE.getCode(),RichFontStyle.SIZE_THREE.getMsg());
        map.put(RichFontStyle.SIZE_FOUR.getCode(),RichFontStyle.SIZE_FOUR.getMsg());
        map.put(RichFontStyle.SIZE_FIVE.getCode(),RichFontStyle.SIZE_FIVE.getMsg());
        map.put(RichFontStyle.SIZE_SIX.getCode(),RichFontStyle.SIZE_SIX.getMsg());
        map.put(RichFontStyle.SIZE_SEVEN.getCode(),RichFontStyle.SIZE_SEVEN.getMsg());
        map.put(RichFontStyle.SIZE_EIGHT.getCode(),RichFontStyle.SIZE_EIGHT.getMsg());
        return map;
    }

    public static RichFontStyle getRichFontStyle(int index) {
        RichFontStyle[] values = RichFontStyle.values();
        for (RichFontStyle value : values) {
            if (value.getCode() == index) {
                return value;
            }
        }
        return RichFontStyle.SIZE_TWO;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
